const BaseHandler = require('../base-handler');
const HTTP_VERBS = require('../../../constants').HTTP_VERBS;

class LatestUploadPhotosHandler extends BaseHandler {

    get pattern() {
        return '/wall/photos';
    }


    doGET(request, response) {
        var since = request.query.since || 'now';
        var wallId = request.query.wall_id;
        var platform = request.query.platform || '';

        var params = {
            wall_id: wallId,
            since: since,
            platform: platform
        };
        this.Controller.getLatestUploadPhotos(params, (result) => {
            response.json({
                success: true,
                data: result
            });
        });
    }

    setup() {
        this.registerVerb(HTTP_VERBS.GET, this.doGET);
    }
}

module.exports = LatestUploadPhotosHandler;